<html>
<head><meta charset="utf-8"><title>manual `impl !Sync` needed? · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/manual.20.60impl.20!Sync.60.20needed.3F.html">manual `impl !Sync` needed?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247391876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/manual%20%60impl%20%21Sync%60%20needed%3F/near/247391876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/manual.20.60impl.20!Sync.60.20needed.3F.html#247391876">(Jul 27 2021 at 21:06)</a>:</h4>
<p>I see that <code>Rc</code> has <code>impl&lt;T: ?Sized&gt; !marker::Sync for Rc&lt;T&gt; {}</code>. But <code>Rc</code> transitively contains a <code>Cell</code>, which is itself <code>!Sync</code>, so is this line unnecessary? Likewise <code>Cell</code> has <code>impl&lt;T: ?Sized&gt; !Sync for Cell&lt;T&gt; {}</code>, but <code>Cell</code> wraps <code>UnsafeCell</code>, which is <code>!Sync</code>. Are these impls actually doing anything?</p>



<a name="247391909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/manual%20%60impl%20%21Sync%60%20needed%3F/near/247391909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/manual.20.60impl.20!Sync.60.20needed.3F.html#247391909">(Jul 27 2021 at 21:06)</a>:</h4>
<p>I'm not proposing to remove them, I'm just making sure something more subtle isn't going on here</p>



<a name="247392409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/manual%20%60impl%20%21Sync%60%20needed%3F/near/247392409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/manual.20.60impl.20!Sync.60.20needed.3F.html#247392409">(Jul 27 2021 at 21:11)</a>:</h4>
<p>It may make error messages explaining why <code>Rc</code> is not <code>Sync</code> simpler by not showing the inner <code>Cell</code> but the explicit negative impl as cause I think.</p>



<a name="247392888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/manual%20%60impl%20%21Sync%60%20needed%3F/near/247392888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/manual.20.60impl.20!Sync.60.20needed.3F.html#247392888">(Jul 27 2021 at 21:15)</a>:</h4>
<p>that sounds like a reasonable explanation</p>



<a name="247401137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/manual%20%60impl%20%21Sync%60%20needed%3F/near/247401137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> inquisitivecrystal <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/manual.20.60impl.20!Sync.60.20needed.3F.html#247401137">(Jul 27 2021 at 22:34)</a>:</h4>
<p>If that's the reason, it would be good to add a comment.</p>



<a name="247402078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/manual%20%60impl%20%21Sync%60%20needed%3F/near/247402078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/manual.20.60impl.20!Sync.60.20needed.3F.html#247402078">(Jul 27 2021 at 22:44)</a>:</h4>
<p>I assume there's probably a UI test somewhere that would stop someone from removing it (assuming it really is for better error messages), but sure, I'll send a PR adding comments here</p>



<a name="247402945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/manual%20%60impl%20%21Sync%60%20needed%3F/near/247402945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/manual.20.60impl.20!Sync.60.20needed.3F.html#247402945">(Jul 27 2021 at 22:52)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/87530">https://github.com/rust-lang/rust/pull/87530</a></p>



<a name="247513897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/manual%20%60impl%20%21Sync%60%20needed%3F/near/247513897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/manual.20.60impl.20!Sync.60.20needed.3F.html#247513897">(Jul 28 2021 at 20:37)</a>:</h4>
<p>I'm hopeful (<a href="https://internals.rust-lang.org/t/pondering-negative-trait-promises/8265?u=scottmcm">https://internals.rust-lang.org/t/pondering-negative-trait-promises/8265?u=scottmcm</a>) that one day these will be used as part of the error messages.</p>
<p>Getting "f32 will never be Ord; here's the doc comment about it" is way better than "perhaps you need to implement Ord for f32".  (Though I'm sure we have a good error for that specific case already, just using the obvious example.)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>